<?php
	class connect_db{
		protected $_hostname = "localhost";
		protected $_user = "root";
		protected $_pass = "";
		protected $_data = "xemay";
		protected $_con;
		protected $_result;
		
		public function connect(){
			$this->_con = mysql_connect($this->_hostname, $this->_user, $this->_pass);
			mysql_select_db($this->_data, $this->_con);
		}
		public function disconnect(){
			if($this->_con){
				mysql_close($this->_con);
			}
		}
		public function query($sql){
		$this->_result=mysql_query($sql);
		}
		public function num_rows(){
			if($this->_result){
				$row= mysql_num_rows($this->_result);	
			}else{
				$row=0;	
			}
			return $row;
		}
		public function fetch(){
			if($this->_result){
				$row=mysql_fetch_assoc($this->_result);	
			}else{
				$row=0;
			}
			return $row;
		}
	}
?>